package _022_2_15

func reverseWords(s string) string {
	data := make([]byte, 0)
	startI := 0
	for i := 0; i < len(s); {
		startI = i

		for ; i < len(data); i++ {
			if s[i] == ' ' {
				break
			}
		}

		for k := startI; k < i; k++ {
			data = append(data, s[i-1-k-startI])
		}

		i++
		if i < len(s) {
			data = append(data, ' ')
		}
	}

	return string(data)
}
